MediaPlayer Kit Objective-C API Overview
- The AgoraMediaPlayer class provides the main methods that can be invoked by your application.
- The delegate callbacks in the AgoraMediaPlayerKitDelegate protocol report runtime events to the application.
Main methods
Method | Description |
---|---|
initWithDelegate | Creates AgoraMediaPlayer. |
initWithDelegate | Creates AgoraMediaPlayer and sets the voice chat mode. |
destroy | Destroys AgoraMediaPlayer. |
setLogFile | Specifies the output log files of the Mediaplayer Kit. |
setLogFilter | Sets the output log level of the Mediaplayer Kit. |
AgoraMediaPlayerDelegate | Sets the AgoraMediaPlayerDelegate protocol. |
setView | Sets the view. |
setRenderMode | Sets the render mode of the view. |
open | Opens the media resource. |
setLoopCount | Sets the loop playback. |
changePlaybackSpeed | Changes the playback speed. |
selectAudioTrack | Selects the audio track used during playback. |
play | Plays the media resource. |
pause | Pauses the playback. |
stop | Stops the playback. |
seekToPosition | Seeks to a new playback position. |
mute | Sets whether to mute the media resource. |
getMute | Confirms whether the media resource is muted. |
adjustVolume | Adjusts the local playback volume. |
getPlayPosition | Gets current local playback progress. |
getDuration | Gets the duration of the media resource. |
getPlayerState | Gets current playback state. |
getStreamCount | Gets the number of the media streams in the media resource. |
getStreamByIndex | Gets the detailed information of the media stream AgoraMediaStreamInfo. |
getPlayerSdkVersion | Gets the version number of the MediaPlayer Kit. |
switchSrc | Switches the media resource being played. |
addPreloadSrc | Preloads media resources. |
playPreload | Plays preloaded media resources. |
Main events
Event | Description |
---|---|
didChangedToState | Reports the playback state change. |
didChangedToPosition | Reports current playback progress. |
didOccurEvent | Reports the playback event. |
didReceiveData | Reports the reception of the media metadata. |
didReceiveVideoFrame | Occurs when each time the player receives a video frame. |
didReceiveAudioFrame | Occurs when each time the player receives an audio frame. |
didPlayBufferUpdate | Reports the playback duration that the buffered data can support. |
didPreloadEvent | Reports the events for preloading media resources. |